LPRINT, LPRINT USING Statements ---------------------------------------------------------------------------- Action Print data on the printer LPT1. Syntax LPRINT expressionlist {;|,} LPRINT USING formatstring$; expressionlist {;|,} Remarks These statements function in the same way as the PRINT and PRINT USING statements except that output goes to the printer. The following list describes the parts of the LPRINT and LPRINT USING statements. ----------------------------------------------------------------------------- Part Description ---------------------------------------------------------------------------- expressionlist The values that are printed on printer LPT1. formatstring$ Specifies the format, using the same formatting characters as the PRINT USING statement. Part Description ---------------------------------------------------------------------------- PRINT USING statement. {;|,} Determines the location on the page of the first value printed by the next statement to use LPT1 (such as the next LPRINT statement or a PRINT # or WRITE # directing data to LPT1). The semicolon means to print immediately after the last value in this LPRINT statement; the comma means to print at the start of the next unoccupied print zone. The printer output from an LPRINT statement will be the same as the screen output from a PRINT statement, if both statements have the same expressionlist values and output-line width. The printer output from an LPRINT USING statement will be the same as the screen output from a PRINT USING statement, if both statements have the same values for formatstring$, expressionlist, and output-line width. The LPRINT statement assumes an 80-character-wide printer. This width can be changed with a WIDTH statement. If you use LPRINT with no arguments, a blank line is printed. Warning Because the LPRINT statement uses the LPT1 printer device, you should not use LPRINT in a program that also contains an OPEN "LPT1" statement. Using these two statements together produces unpredictable results. BASICA An LPRINT CHR$(13) statement actually outputs both CHR$(13) and CHR$(10). This feature was created to provide compatibility with BASICA. See Also PRINT, PRINT USING, WIDTH Example The following example prompts the user for team names and the names of players on each team. Then it prints the players and their teams on the printer. CLS' Clear screen. LPRINT "Team Members"; TAB(76); "TEAM" . LPRINT INPUT "How many teams"; TEAMS INPUT "How many players per team";PPT PRINT FOR T = 1 TO TEAMS INPUT "Team name. ", TEAM$ FOR P = 1 TO PPT INPUT " Enter player name. ", PLAYER$ LPRINT PLAYER$; IF P < PPT THEN IF LPOS(0) > 55 THEN ' Print a new line if print LPRINT . LPRINT " "; ' head is past column 55. ELSE LPRINT ", ";' Otherwise, print a comma. END IF END IF NEXT P LPRINT STRING$(80-LPOS(0)-LEN(TEAM$),"."); TEAM$ NEXT T